﻿using Mes.Domain.BoundedContext.Entities.MasterData;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Mes.Infrastructure.Data.BoundedContext.EntityTypeConfigurations.MasterData
{
    public class MaterialBOMMaterialLinkEntityConfig : IEntityTypeConfiguration<MaterialBOMMaterialLink>
    {
        public void Configure(EntityTypeBuilder<MaterialBOMMaterialLink> builder)
        {
            builder.ToTable("materialbommateriallink");
            builder.Property(b => b.MaterialBOMId).HasColumnName("materialbomid").IsRequired();
            builder.Property(b => b.MaterialId).HasColumnName("materialid").IsRequired();
            builder.HasKey(b => new { b.MaterialId, b.MaterialBOMId });
            builder.Property(b => b.MaterialNumber).HasColumnName("materialnumber").IsRequired();
        }
    }
}
